<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=320,maximum-scale=1.3,user-scalable=no">
    <meta name="keywords" content="叮当快药">
    <meta name="description" content="叮当快药">
    <meta name="format-detection" content="telephone=no, email=no">
    <title>感冒发烧</title>
    <link href="{{ asset('myhome/css/mkui-reset.css') }}" rel="stylesheet">
    <link href="{{ asset('myhome/css/mkui-base.css') }}" rel="stylesheet">
    <link href="{{ asset('myhome/css/mkui-skin.css') }}" rel="stylesheet">
    <link href="{{ asset('myhome/css/mkui-alert.css') }}" rel="stylesheet">
    <link href="{{ asset('myhome/css/global.css') }}" rel="stylesheet">
    <link rel="stylesheet" href="{{ asset('myhome/css/common.css') }}">
    <link rel="stylesheet" href="{{ asset('myhome/css/list.css') }}">
    <link rel="stylesheet" href="{{ asset('myhome/css/search.css') }}">
    <link rel="stylesheet" href="{{ asset('myhome/css/font.css') }}">
    <link rel="stylesheet" href="{{ asset('myhome/css/header.css') }}">
    <link rel="stylesheet" href="{{ asset('myhome/css/footer.css') }}">
    <link rel="stylesheet" href="{{ asset('myhome/css/index.css') }}">
    <link rel="stylesheet" href="{{ asset('myhome/css/responsive.css') }}">
    <style>
 .index-list {  width: 100%;  background: #fff;  }
li {  list-style: none;  }
 .index-list li {  border-right: 1px solid #dbdbdb;  border-bottom: 1px solid #dbdbdb;  width: 33.33%;  height: 40px;  float: left;  line-height: 40px;  }
.index-list li h2 {  width: 100%;  height: 100%;  text-align: center;  font-size: 15px;  font-weight: normal;  }
 .index-list .active {  border-right: 1px solid #D34444;  border-bottom: 1px solid #D34444;  }
 .index-list .active h2 {  color: #FFF;  background: #EA4B4B;  }
        .look-all {
            text-align: center;
            color: #9b9b9b;
            line-height: 38px;
            height: 38px;
            border-bottom: 1px solid #dbdbdb;
            margin-bottom: 5px;
            background: #fff;
        }

        .mask {
            z-index: 3;
        }

        /*搜索无结果*/
        .section-result .title-msg dt i {
            display: block;
            background: url(http://img.ddsy.com/c/wap/images/wap/sousuo_no.jpg) center center no-repeat;
            background-size: contain;
            width: 72px;
            height: 53px;
            margin: 0 auto;
        }

        .section-result .title-msg dd span {
            width: 100%;
            height: 38px;
            line-height: 38px;
            font-size: 15px;
            color: #FCA361;
        }

        .section-result .title-msg dd a {
            width: 130px;
            height: 28px;
            line-height: 28px;
            text-align: center;
            background-color: #e04f4f;
            color: #FFF;
            border-radius: 4px;
        }

        .lookall {
            width: 14px;
            height: 7px;
            margin-left: .3rem;
            margin-bottom:.1rem;
        }

        nav {
            background: #fff;
        }

        .lookup {
            font-size: 13px;
        }

        .list_bigshow dd p {
            height: 29px;
        }

        .items dd h3 {
            font-size: 15px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-family: "微软雅黑";
            font-weight: bold;
        }

        .items dd h3 .ico-chufang {
            vertical-align: middle;
        }

        .list_bigshow dd h3 {
            font-size: 14px;
            height: 37px;
            line-height: 18px;
            font-weight: bold;
            width: 100%;
            display: -webkit-box;
            overflow: hidden;
            text-overflow: ellipsis;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            margin-bottom: 3px;
        }

        .list_bigshow dd h3 .ico-chufang {
            vertical-align: middle;
        }
        ._box {
            position: absolute;
            z-index: 9
        }
        .icon-cart{ font-size:1rem;}
    </style>
</head>

<body>

<!--start-->
<div class="list-index" style="display: block;">
    <!--搜索的 -->
    <div class="m-search cl none">
        <div class="search_k">
            <i></i>
            <input class="search search_w" id="" type="text">
            <span class="icon-cancel"></span>
        </div>
        <i class="icon_r" onclick="queDing()">搜索</i>
        <ul id="suggestlist" class="cargo-list none">

        </ul>
    </div>
    <!--来自首页页面 -->
    <!--来自18g个分类页面start-->
    <ul class="index-list cl none" style="display: block;">
        @foreach($res as $k=>$v)
            <li ordertypeid='4' class="@if($v->name==$label) active @else ' ' @endif " onclick="selpro('sale',this)">
                <h2>{{ $v->name }}</h2></li>
        @endforeach
    </ul>
    <div class="look-all none" style="display: block;"><span class="lookup">收起</span><img
                src="{{ asset("myhome/img/toup.png") }}" class="lookall"></div>
    <!--来自分类页面 -->
    <div class="top none">
    </div>
    <nav class="toptip">
        <ol>
            <li ordertypeid="0" class="active" onclick="selpro('sale',this)">默认</li>
            <li ordertypeid="3" onclick="selpro('sale',this)">销量</li>
            <li ordertypeid="2" onclick="selpro('price',this)">价格 <i class="ico"><span class="sanjiao-up"></span><span
                            class="sanjiao-down"></span></i>
            </li>
        </ol>
        <div class="nav_change">
            <img class="img_one" src="{{ asset('myhome/img/v3-bigpic.png')}}" alt="显示小图">
            <img class="img_two none" src="{{ asset('myhome/img/v3-smallpic.png')}}" alt="显示大图">
            <span class="big-title">大图</span>
        </div>
    </nav>
    <article>
        <div class="list_bigshow cl"></div>
        <ul id="did">
            @foreach($pro as $v)

                <div class='list-items'>


                        <li onclick="window.location.href='{{ url("/product/".$v->id) }}' ">

                        <dl class='items'>
                            <dt><img src='/upload/product/{{ $v->preview }}' width="100"></dt>
                            <dd><h3>{{ $v->name }}</h3>
                                <p style='height:35px;'>{{ $v->summary }}</p>
                                <p style='height:18px;'>{{ $v->specifications }}</p><span><b>¥{{ $v->price }}</b></span><i onclick="incart({{$v->id}},this)" class='addcar'></i>
                            </dd>
                        </dl>

                        </li>


                </div>

            @endforeach
        </ul>
    </article>
</div>

<!--搜索无结果显示start-->
<div class="section-result none" style="display: none;">
    <dl class="title-msg">
        <dt><i></i></dt>
        <dd>
            <span>小叮找不到此商品，您可以问问药师~</span>
            <a class="toservice" href="">药师咨询</a>
            <!--对不起，暂无“<span class='name'></span>”相关的商品<br>
    您可以试试其他的搜索词-->
        </dd>
    </dl>
    <p class="goods-name none">当季热门商品</p>
    <div class="setion-msg cl">

    </div>
</div>
<!--/搜索无结果显示end-->
<div class="telphone none">
    <ul class="list">

    </ul>
    <ul class="button" onclick="quXiaoTel()">
        <li id="cancel" class="no">取消</li>
    </ul>
</div>
<div id="jz"
     style="display:block ;text-align: center;height:2rem;width: 100%; padding-left: 43%;background-color: white;margin-bottom: 5px">
    <div id="jzz">
        <img src="/img/jzz.gif" width="30px" style=" float: left;"> <span
                style=" float: left;margin-top: 0.4rem">加载中</span>
    </div>
</div>
<menu>
    <a href="{{ url('/') }}"><i class="icon-home"></i>首页</a>
    {{--<a href="member-order.html"><i class="icon-lipin"></i>疗程购</a>--}}
    {{--<a href=""><i class="icon-selectmore"></i>品牌优购</a>--}}
    <a href="/home/liaochenggou"><i class="icon-selectmore"></i>疗程购</a>
    <a onclick="dosel();" id="orderCart"><i class="icon-cart" id="end">
            <span id="num" style="display: none;"></span></i >购物车</a>
    <a href="{{ url('home/user') }}"><i class="icon-head"></i>我的</a>
</menu>
<!--购物车-->
<div class="cartContent fadeInBottom100" id="cartContent">
    <div class="LayerHeader line">
        <button onclick="delqing();" class="Del"><i class="icon-delete"></i>清空</button>
        <button class="close pl"><i class="icon-plus rot45"></i></button>
    </div>

    <div class="cartContentList">
        <input type='hidden' name='_token' value='{{ csrf_token() }}'>
        <ul class="line-li">

        </ul>
    </div>

</div>
<div style="width:100%; height:1rem"></div>
<script type="text/javascript" src="{{ asset('myhome/js/common.js') }}"></script>
<script type="text/javascript" src="{{ asset('jquery-1.8.3.min.js') }}"></script>
<script>
    //    alert(getScrollTop()+':'+getWindowHeight()+':'+getScrollHeight())
    //根据内容高度确定是否显示加载条
    if (getWindowHeight() + 20 < getScrollHeight()) {
        $("#jz").css('display', 'block');
    } else {
        $("#jz").css('display', 'none');
    }
    var order = "sale";
    var type = "{{ $label }}";
    var asc = 'desc';
    var page = '1';
    var jzz = document.getElementById('jz');
    function selpro(od, bn) {
        page = '1';

        //封装查询条件
        if ($(bn).attr('ordertypeid') == 2) {
            asc = asc == 'desc' ? 'asc' : 'desc';
            order = od;
        } else if ($(bn).attr('ordertypeid') == 4) {
            $('.active').attr('class', ' ');
            $(bn).attr('class', 'active');
            type = $(bn).children('h2').html();
            asc = 'desc';
            order = 'sale';
        } else {
            asc = 'desc';
            order = od;
        }
        var str = " ";
        //请求不同分类的商品
        $.ajax({
            url: '{{url("selpro")}}',
            type: 'POST',
            dataType: 'json',
            cache: false,
            data: {_token: "{{ csrf_token() }}", order: order, type: type, asc: asc},
            success: function (data) {
                for (var i = 0; i < data.data.length; i++) {
                    str = str + "<div class='list-items'><li " + "onclick=window.location.href='/product/" + data.data[i].id + "'><dl class='items'><dt><img src='/upload/product/" + data.data[i].preview + "' ></dt><dd><h3>" + data.data[i].name + "</h3> <p style='height:35px;'>" + data.data[i].summary + "</p> <p style='height:18px;'>" + data.data[i].specifications + "</p><span><b>¥" + data.data[i].price + "</b></span><i class='addcar' ></i></dd></dl></li></div>"
                }
                $('#did').html(str);
                //根据内容高度确定是否显示加载条
                if (getWindowHeight() + 20 < getScrollHeight()) {
                    $("#jz").css('display', 'block');
                } else {
                    $("#jz").css('display', 'none');
                }
            }
        });
    }
    //滚动触底加载新商品
    function resel() {
        var str = " ";
        page++;
        $.ajax({
            url: '/selpro?page=' + page,
            type: 'POST',
            dataType: 'json',
            cache: false,
            data: {_token: "{{ csrf_token() }}", order: order, type: type, asc: asc},
            success: function (data) {
                for (var i = 0; i < data.data.length; i++) {
                    str = str + "<div class='list-items'><li " + "onclick=window.location.href='/product/" + data.data[i].id + "'><dl class='items'><dt><img src='/upload/product/" + data.data[i].preview + "' ></dt><dd><h3>" + data.data[i].name + "</h3> <p style='height:35px;'>" + data.data[i].summary + "</p> <p style='height:18px;'>" + data.data[i].specifications + "</p><span><b>¥" + data.data[i].price + "</b></span><i class='addcar' ></i></dd></dl></li></div>";
                }
                var tip = $(str);
                $("#did").append(tip);
                if (data.data.length == 0) {
                    $("#jz").css('display', 'none');
                }
            }
        });
    }
    //滚动触底执行请求加载新商品
    var scl = document.body;
    scl.onscroll = function () {
        //alert(getScrollTop()+':'+getWindowHeight()+':'+getScrollHeight())
        if (getScrollTop() + getWindowHeight() + 20 >= getScrollHeight()) {
            $("#jz").css('display', 'block');
            resel();
        }
    };
    //获取滚动条的上高度
    function getScrollTop() {
        var scrollTop = 0, bodyScrollTop = 0, documentScrollTop = 0;
        if (document.body) {
            bodyScrollTop = document.body.scrollTop;
        }
        if (document.documentElement) {
            documentScrollTop = document.documentElement.scrollTop;
        }
        scrollTop = (bodyScrollTop - documentScrollTop > 0) ? bodyScrollTop : documentScrollTop;
        return scrollTop;
    }
    //文档的总高度
    function getScrollHeight() {
        var scrollHeight = 0, bodyScrollHeight = 0, documentScrollHeight = 0;
        if (document.body) {
            bodyScrollHeight = document.body.scrollHeight;
        }
        if (document.documentElement) {
            documentScrollHeight = document.documentElement.scrollHeight;
        }
        scrollHeight = (bodyScrollHeight - documentScrollHeight > 0) ? bodyScrollHeight : documentScrollHeight;
        scrollHeight = scrollHeight;
        return scrollHeight - 1;
    }
    //浏览器视口的高度
    function getWindowHeight() {
        var windowHeight = 0;
        if (document.compatMode == "CSS1Compat") {
            windowHeight = document.documentElement.clientHeight;
        } else {
            windowHeight = document.body.clientHeight;
        }
        return windowHeight;
    }


    //列表的展开收起
    $('.look-all').click(function() {
        if ($('.lookup').html() == '展开查看全部') {
            $('.lookup').html('收起');
            $('.lookall').attr('src','{{ asset("myhome/img/toup.png") }}');
            $('.index-list li').eq(5).nextAll().show();
        } else {
            $('.lookup').html('展开查看全部');
            $('.lookall').attr('src','{{ asset("myhome/img/todown.png") }}');
            $('.index-list li').eq(5).nextAll().hide();
        }
    });

    //显示大图或者列表（ 仅图标的变化）
    //    $('.list-index .nav_change').click(function(arr) {
    //        $('.list-index .list_bigshow').empty();
    //        $('.list-index article ul').empty();
    //        if ($(this).hasClass('nav_nowbig')) {
    //            $(this).removeClass('nav_nowbig');
    //            $('.list-index .nav_change .img_one').show();
    //            $('.list-index .nav_change .img_two').hide();
    //            $('.big-title').html('大图');
    //            $('.list-index article ul').append(listIndexShow_small);
    //            $(".list-index article li").click(function () {
    //                window.location.href = "shangpinxiangqing.html?" + $(this).attr("class");
    //            });
    //        } else {
    //            $(this).addClass('nav_nowbig');
    //            $('.list-index .nav_change .img_one').hide();
    //            $('.list-index .nav_change .img_two').show();
    //            $('.big-title').html('列表');
    //            $('.list-index .list_bigshow').append(listIndexShow_big);
    //            $('.list-index .list_bigshow .item').click(function () {
    //                window.location.href = "shangpinxiangqing.html?" + $(this).find('dt').attr("date-shopid");
    //            });
    //        }
    //    });


</script>
<script type="text/javascript" src="{{ asset('myhome/js/common.js') }}"></script>
<script>
    $.ajax({
        url: '{{ url("home/ajax/cart/num") }}',
        async: false,				//是否异步
        type: 'post',				//请求方式
        data: { '_token': "{{ csrf_token() }}"},				//发送的数据
        dataType: 'json',			//响应的数据类型
        success: function (data)		//成功时回调函数
        {
            if (data != 0) {
                $('#num').css('display','');
                $('#num').html(data);
            }
        }
    });

    function dosel() {
        $.ajax({
            url: '{{ url("home/ajax/cart") }}',
            async: false,				//是否异步
            type: 'post',				//请求方式
            data: {'_token': "{{ csrf_token() }}"},				//发送的数据
            dataType: 'json',			//响应的数据类型
            error: function () {

            },
            success: function (data)		//成功时回调函数
            {
                if(data == null){
                    if(confirm("您还没有登录，是否登录")){
                        location.href = "{{ url('home/user/login') }}";
                    }
                }
                if(data){
                    //使购物车上来
                    if ($("#cartContent").is(":hidden")) {
                        $("html,body").css({"overflow": "hidden"}); //为html,body添加样式
                        $("#cartContent").show(); //显示内容
                        $("body").append("<samp class='LayerBackground fadeIn' id='cartLayer'></samp>"); //插入背景层
                        //配送点
                        if ("#cartContent" == "#DeliveryContent") {
                            $("#cartLayer").css("top", "2.5rem");
                        }
                        //配送说明
                        if ("#cartContent" == "#DeliverysContent") {
                            $("#cartLayer").css("z-index", "104");
                        }
                    }
//                    else{
//                        $("html,body").removeAttr("style"); //清除html,body样式
//                        $("#cartLayer").addClass("fadeOut"); //添加背景层样式
//                        $("#cartContent").addClass("fadeOutBottom100"); //添加内容样式
//                        setTimeout(function(){
//                            $("#cartContent").hide().removeClass("fadeOutBottom100"); //关闭内容
//                            $("#cartLayer").remove(); //清除背景层
//                        }, 800);
//                    }

                    //使购物车下去
                    $("#cartContent .close").bind('click', function () {

                        $("html,body").removeAttr("style"); //清除html,body样式
                        $("#cartLayer").addClass("fadeOut"); //添加背景层样式
                        if ("#cartContent" == "#orderPay") {
                            $("#cartContent").addClass("fadeOutBottom20"); //添加内容样式
                        } else {
                            $("#cartContent").addClass("fadeOutBottom100"); //添加内容样式
                        }
                        setTimeout(function () {
                            $("#cartContent").hide().removeClass("fadeOutBottom100").removeClass("fadeOutBottom20"); //关闭内容
                            $("#cartLayer").remove(); //清除背景层
                        }, 800);
                    });

                    //遍历购物车信息
                    if (data.length > 0) {
                        //先删除ul里面的所有li 然后再遍历添加
                        $('.line-li').children('li').remove();
                        $('.LayerFooter').remove();
                        var sum = 0;
                        for (var i = 0; i < data.length; i++) {
                            if(data[i].status == 1){
                                $('.line-li').append("<li><div class='order-Address'><button onclick='doChoice(" + data[i].id + ",this);'><i class='icon-error'></i></button><button onclick='doCancel(" + data[i].id + ",this);' style='float:right;'>X</button></div><img src='/upload/product/" + data[i].preview + "' ><p>" + data[i].name + "</p><span>¥" + data[i].price + "</span> <div class='D-BuyNum' ><button onclick='dominus(" + data[i].id + ", this);'><i class='icon-reduce'></i></button><input type='number' class='line' value='" + data[i].count + "'><button onclick='doadd(" + data[i].id  + ", this);' ><i class='icon-plus'></i></button></div></li>");
                            }else{
                                $('.line-li').append("<li><div class='order-Address'><button class='choice' onclick='doChoice(" + data[i].id + ",this);'><i class='icon-error'></i></button><button onclick='doCancel(" + data[i].id + ",this);' style='float:right;'>X</button></div><img src='/upload/product/" + data[i].preview + "' ><p>" + data[i].name + "</p><span>¥" + data[i].price + "</span> <div class='D-BuyNum' ><button onclick='dominus(" + data[i].id + ", this);'><i class='icon-reduce'></i></button><input type='number' class='line' value='" + data[i].count + "'><button onclick='doadd(" + data[i].id + ", this);' ><i class='icon-plus'></i></button></div></li>");
                                sum += (data[i].price * data[i].count);
                            }

                        }
                        $('.line-li').parent().after("<div class='LayerFooter'> 共计：¥<span id='sum'>" + sum + "</span> <span class='memberOrder-list'><a href='/home/user/order/suborder'><button >去结算</button></a></span> </div>");
                    } else {
                        $('.line-li').children('li').remove();
                        $('.line-li').append("<li><p>您的购物车还是空的</p></li>");

                    }
                }

            }
        });
    }

    //选中商品与取消选中商品
    function doChoice(id,bn){

        if($(bn).attr('class') == 'choice'){
            $(bn).removeAttr('class');
            var status = 1;
        }else{
            $(bn).attr('class' , 'choice');
            var status = 2;
        }
        $.ajax({
            url: '{{ url("home/ajax/cart/cartStatus") }}',
            async: false,				//是否异步
            type: 'post',				//请求方式
            data: {id: id,status:status, '_token': $('input[name=_token]').val()},				//发送的数据
            dataType: 'json',			//响应的数据类型
            success: function (data)		//成功时回调函数
            {
                if (data != false) {
                    $('#sum').html(data.sum);
                } else {
                    alert("网络错误！");
                }

            }
        });

    }

    //删除商品
    function doCancel(id,bn){
        if (confirm("你确定要删除吗？")) {
            $.ajax({
                url: '{{ url("home/ajax/cart/delProduct") }}',
                async: false,				//是否异步
                type: 'post',				//请求方式
                data: {id: id, '_token': $('input[name=_token]').val()},				//发送的数据
                dataType: 'json',			//响应的数据类型
                success: function (data)		//成功时回调函数
                {
                    if (data != false) {
                        $(bn).parent().parent().remove();
                        if(data.num == 0){
                            $('.LayerFooter').remove();
                            $('#num').css({display:"none"});
                            $('.line-li').append("<li><p>您的购物车还是空的</p></li>");
                        }else{
                            $('#sum').html(data.sum);
                            $('#num').html(data.num);
                        }
                    }
                }
            });
        }
    }

    //数量加1
    function doadd(id, bn) {
        $.ajax({
            url: '{{ url("home/ajax/cart/doadd") }}',
            async: false,				//是否异步
            type: 'post',				//请求方式
            data: {id: id, '_token': $('input[name=_token]').val()},				//发送的数据
            dataType: 'json',			//响应的数据类型
            success: function (data)		//成功时回调函数
            {
                if (data != false) {
                    if(data == null){
                        alert('您的购物车中不存在该商品!');
                    }else{
                        $('#sum').html(data.sum);
                        $(bn).prev().val(data.count);
                        $('#num').html(data.num);
                    }

                } else {
                    alert("超出最大限制");
                }

            }
        });
    }

    //数量减1
    function dominus(id, bn) {
        if ($(bn).next().val() == 1) {
            if (!confirm("你确定要删除吗？")) {
                return 0;
            }
        }
        $.ajax({
            url: '{{ url("home/ajax/cart/dominus") }}',
            async: false,				//是否异步
            type: 'post',				//请求方式
            data: {id: id, '_token': $('input[name=_token]').val()},				//发送的数据
            dataType: 'json',			//响应的数据类型
            success: function (data)		//成功时回调函数
            {
                if (data != false) {
                    if(data.delete == 2){
                        $('#sum').html(data.sum);
                        $(bn).next().val(data.count);
                        $('#num').html(data.num);
                    }else{
                        $(bn).next().val(data.count);
                        $(bn).parent().parent().remove();
                        if(data.num == 0){
                            $('.LayerFooter').remove();
                            $('#num').css({display:"none"});
                            $('.line-li').append("<li><p>您的购物车还是空的</p></li>");
                        }else{
                            $('#sum').html(data.sum);
                            $('#num').html(data.num);
                        }
                    }

                }
            }
        });


    }

    function delqing() {
        if (confirm("你确定要清空购物车吗？")) {
            $.ajax({
                url: '{{ url("home/ajax/cart/delqing") }}',
                async: false,				//是否异步
                type: 'post',				//请求方式
                data: {'_token': $('input[name=_token]').val()},				//发送的数据
                dataType: 'json',			//响应的数据类型
                success: function (data)		//成功时回调函数
                {
                    if (data == true) {
                        $('.line-li').children('li').remove();
                        $('.LayerFooter').remove();
                        $('#num').css({display:"none"});
                        $('.line-li').append("<li><p>您的购物车还是空的</p></li>");
                    }
                }
            });
        }
    }


    //点击商品加入购物车
    function incart(pid,obj,e) {
        var e = e || window.event;
        if ( e && e.stopPropagation ){
            e.stopPropagation();
        }else{
            e.cancelBubble = true;
        }

        if("{{ session('homeuser') }}"){
            $.ajax({
                url: '{{ url("home/ajax/cart/incart") }}',
                async: false,				//是否异步
                type: 'post',				//请求方式
                data: {_token: "{{ csrf_token() }}",pid:pid},				//发送的数据
                dataType: 'json',			//响应的数据类型
                success: function (data)		//成功时回调函数
                {

                    var tmp;
                    if (data != false) {
//                        //添加到购物车起飞效果
//                        if (tmp) tmp.remove();
//                        var box = $(obj).parent().parent();
//
//                        var img = $(obj).parent().parent().find('img');
//                        console.log(img);
//                        tmp = img.clone();
//                        var p = $(img).offset();
//                        var p2 = $('#end').offset();
//                        tmp.addClass('_box').css(p).appendTo(box);
//                        p2 = $.extend(p2, {height: 5, width: 5, opacity: 10});
//                        console.log(p);
////                        console.log(p2);
//                        console.log($(tmp).offset());

//                        $(tmp).animate(p2, 20000, function () {
                        alert('成功加入购物车！');
                            $('#num').attr("style", "display:block");
                            $('#num').html(data);
//                            tmp.remove();

//                        });

                    } else {
                        alert("添加购物车失败！")
                    }
                }
            });
        }else{

            if(confirm("您还没有登录，是否登录")){

                location.href = "{{ url('home/user/login') }}";

            }
            //阻止默认浏览器动作(W3C)
            if ( e )
                e.preventDefault();
            //IE中阻止函数器默认动作的方式
            else
                window.event.returnValue = false;
            return false;
        }


    }
</script>